<template>
    <div class="header-box">
        <div class="l-header">
            <el-button class="header-btn" @click="handelCollapse()" type="primary" plain size="small">
                <el-icon>
                    <Connection />
                </el-icon>
            </el-button>
            <!-- 面包屑 -->
            <el-breadcrumb separator="/">
                <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item :to="current.path" v-if="current">{{ current.label }}</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="r-header">
            <!-- 用户头像 -->
            <el-dropdown>
                <span class="el-dropdown-link">
                    <img class="user-img" :src="getImgSrc('user')" alt="">
                </span>
                <template #dropdown>
                    <el-dropdown-menu>
                        <el-dropdown-item>Action 1</el-dropdown-item>
                        <el-dropdown-item>Action 2</el-dropdown-item>
                    </el-dropdown-menu>
                </template>
            </el-dropdown>
        </div>
    </div>
</template>
<style lang="less">
.user-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.header-box {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;

    .l-header {
        display: flex;
        align-items: center;

        .header-btn {
            margin-right: 10px;
        }
    }

}
</style>

<script setup>
// 引入仓库
import { computed } from 'vue';
import { useAside } from '../store/index.js';
const main = useAside()
const current = computed(()=>{
    return main.currentMenu
})

const handelCollapse = () => {
    main.updateIsCollapse()
}

const getImgSrc = (val) => {
    return new URL(`../assets/${val}.png`, import.meta.url).href
}




</script>